class SqlQuery
{
   public static function run(connect:sys.db.Connection,arg:String)
   {
      var rset = connect.request(arg);
      var result = new Array<String>();
      var fields = rset.getFieldsNames();
      if (fields!=null)
      {
         var idx = 0;
         for(row in rset)
         {
            var vals:Dynamic = {};
            for(f in fields)
               Reflect.setField(vals,f, Reflect.field(row,f));
            result[idx++] = vals;
         }
      }
      Sys.println( haxe.Json.stringify(result) );
   }

   public static function main()
   {
      hurts.Db.run(run);
   }
}
